{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "6933b175",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "from matplotlib import pyplot as plt\n",
    "import seaborn as sns\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "4ee0d4e1",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.datasets import load_breast_cancer"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "24ce9e7a",
   "metadata": {},
   "outputs": [],
   "source": [
    "data = load_breast_cancer()['data']\n",
    "cols = load_breast_cancer()['feature_names']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "9a195f95",
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pd.DataFrame(data=data, columns=cols)\n",
    "\n",
    "df['Target'] = load_breast_cancer()['target']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "de18ec0e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>mean radius</th>\n",
       "      <th>mean texture</th>\n",
       "      <th>mean perimeter</th>\n",
       "      <th>mean area</th>\n",
       "      <th>mean smoothness</th>\n",
       "      <th>mean compactness</th>\n",
       "      <th>mean concavity</th>\n",
       "      <th>mean concave points</th>\n",
       "      <th>mean symmetry</th>\n",
       "      <th>mean fractal dimension</th>\n",
       "      <th>...</th>\n",
       "      <th>worst texture</th>\n",
       "      <th>worst perimeter</th>\n",
       "      <th>worst area</th>\n",
       "      <th>worst smoothness</th>\n",
       "      <th>worst compactness</th>\n",
       "      <th>worst concavity</th>\n",
       "      <th>worst concave points</th>\n",
       "      <th>worst symmetry</th>\n",
       "      <th>worst fractal dimension</th>\n",
       "      <th>Target</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>17.99</td>\n",
       "      <td>10.38</td>\n",
       "      <td>122.8</td>\n",
       "      <td>1001.0</td>\n",
       "      <td>0.11840</td>\n",
       "      <td>0.27760</td>\n",
       "      <td>0.3001</td>\n",
       "      <td>0.14710</td>\n",
       "      <td>0.2419</td>\n",
       "      <td>0.07871</td>\n",
       "      <td>...</td>\n",
       "      <td>17.33</td>\n",
       "      <td>184.6</td>\n",
       "      <td>2019.0</td>\n",
       "      <td>0.1622</td>\n",
       "      <td>0.6656</td>\n",
       "      <td>0.7119</td>\n",
       "      <td>0.2654</td>\n",
       "      <td>0.4601</td>\n",
       "      <td>0.11890</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>20.57</td>\n",
       "      <td>17.77</td>\n",
       "      <td>132.9</td>\n",
       "      <td>1326.0</td>\n",
       "      <td>0.08474</td>\n",
       "      <td>0.07864</td>\n",
       "      <td>0.0869</td>\n",
       "      <td>0.07017</td>\n",
       "      <td>0.1812</td>\n",
       "      <td>0.05667</td>\n",
       "      <td>...</td>\n",
       "      <td>23.41</td>\n",
       "      <td>158.8</td>\n",
       "      <td>1956.0</td>\n",
       "      <td>0.1238</td>\n",
       "      <td>0.1866</td>\n",
       "      <td>0.2416</td>\n",
       "      <td>0.1860</td>\n",
       "      <td>0.2750</td>\n",
       "      <td>0.08902</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2 rows × 31 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   mean radius  mean texture  mean perimeter  mean area  mean smoothness  \\\n",
       "0        17.99         10.38           122.8     1001.0          0.11840   \n",
       "1        20.57         17.77           132.9     1326.0          0.08474   \n",
       "\n",
       "   mean compactness  mean concavity  mean concave points  mean symmetry  \\\n",
       "0           0.27760          0.3001              0.14710         0.2419   \n",
       "1           0.07864          0.0869              0.07017         0.1812   \n",
       "\n",
       "   mean fractal dimension  ...  worst texture  worst perimeter  worst area  \\\n",
       "0                 0.07871  ...          17.33            184.6      2019.0   \n",
       "1                 0.05667  ...          23.41            158.8      1956.0   \n",
       "\n",
       "   worst smoothness  worst compactness  worst concavity  worst concave points  \\\n",
       "0            0.1622             0.6656           0.7119                0.2654   \n",
       "1            0.1238             0.1866           0.2416                0.1860   \n",
       "\n",
       "   worst symmetry  worst fractal dimension  Target  \n",
       "0          0.4601                  0.11890       0  \n",
       "1          0.2750                  0.08902       0  \n",
       "\n",
       "[2 rows x 31 columns]"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head(2)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0c3c35c6",
   "metadata": {},
   "source": [
    "## This Dataset has 30 features and 1 output column. \n",
    ">30 is pretty huge as far as dimensionality is concerned. Unnecessary features can act as NOISE."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "9b71ee1b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>count</th>\n",
       "      <th>mean</th>\n",
       "      <th>std</th>\n",
       "      <th>min</th>\n",
       "      <th>25%</th>\n",
       "      <th>50%</th>\n",
       "      <th>75%</th>\n",
       "      <th>max</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>mean radius</th>\n",
       "      <td>569.0</td>\n",
       "      <td>14.127292</td>\n",
       "      <td>3.524049</td>\n",
       "      <td>6.981000</td>\n",
       "      <td>11.700000</td>\n",
       "      <td>13.370000</td>\n",
       "      <td>15.780000</td>\n",
       "      <td>28.11000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean texture</th>\n",
       "      <td>569.0</td>\n",
       "      <td>19.289649</td>\n",
       "      <td>4.301036</td>\n",
       "      <td>9.710000</td>\n",
       "      <td>16.170000</td>\n",
       "      <td>18.840000</td>\n",
       "      <td>21.800000</td>\n",
       "      <td>39.28000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean perimeter</th>\n",
       "      <td>569.0</td>\n",
       "      <td>91.969033</td>\n",
       "      <td>24.298981</td>\n",
       "      <td>43.790000</td>\n",
       "      <td>75.170000</td>\n",
       "      <td>86.240000</td>\n",
       "      <td>104.100000</td>\n",
       "      <td>188.50000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean area</th>\n",
       "      <td>569.0</td>\n",
       "      <td>654.889104</td>\n",
       "      <td>351.914129</td>\n",
       "      <td>143.500000</td>\n",
       "      <td>420.300000</td>\n",
       "      <td>551.100000</td>\n",
       "      <td>782.700000</td>\n",
       "      <td>2501.00000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean smoothness</th>\n",
       "      <td>569.0</td>\n",
       "      <td>0.096360</td>\n",
       "      <td>0.014064</td>\n",
       "      <td>0.052630</td>\n",
       "      <td>0.086370</td>\n",
       "      <td>0.095870</td>\n",
       "      <td>0.105300</td>\n",
       "      <td>0.16340</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean compactness</th>\n",
       "      <td>569.0</td>\n",
       "      <td>0.104341</td>\n",
       "      <td>0.052813</td>\n",
       "      <td>0.019380</td>\n",
       "      <td>0.064920</td>\n",
       "      <td>0.092630</td>\n",
       "      <td>0.130400</td>\n",
       "      <td>0.34540</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean concavity</th>\n",
       "      <td>569.0</td>\n",
       "      <td>0.088799</td>\n",
       "      <td>0.079720</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.029560</td>\n",
       "      <td>0.061540</td>\n",
       "      <td>0.130700</td>\n",
       "      <td>0.42680</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean concave points</th>\n",
       "      <td>569.0</td>\n",
       "      <td>0.048919</td>\n",
       "      <td>0.038803</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.020310</td>\n",
       "      <td>0.033500</td>\n",
       "      <td>0.074000</td>\n",
       "      <td>0.20120</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean symmetry</th>\n",
       "      <td>569.0</td>\n",
       "      <td>0.181162</td>\n",
       "      <td>0.027414</td>\n",
       "      <td>0.106000</td>\n",
       "      <td>0.161900</td>\n",
       "      <td>0.179200</td>\n",
       "      <td>0.195700</td>\n",
       "      <td>0.30400</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean fractal dimension</th>\n",
       "      <td>569.0</td>\n",
       "      <td>0.062798</td>\n",
       "      <td>0.007060</td>\n",
       "      <td>0.049960</td>\n",
       "      <td>0.057700</td>\n",
       "      <td>0.061540</td>\n",
       "      <td>0.066120</td>\n",
       "      <td>0.09744</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>radius error</th>\n",
       "      <td>569.0</td>\n",
       "      <td>0.405172</td>\n",
       "      <td>0.277313</td>\n",
       "      <td>0.111500</td>\n",
       "      <td>0.232400</td>\n",
       "      <td>0.324200</td>\n",
       "      <td>0.478900</td>\n",
       "      <td>2.87300</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>texture error</th>\n",
       "      <td>569.0</td>\n",
       "      <td>1.216853</td>\n",
       "      <td>0.551648</td>\n",
       "      <td>0.360200</td>\n",
       "      <td>0.833900</td>\n",
       "      <td>1.108000</td>\n",
       "      <td>1.474000</td>\n",
       "      <td>4.88500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>perimeter error</th>\n",
       "      <td>569.0</td>\n",
       "      <td>2.866059</td>\n",
       "      <td>2.021855</td>\n",
       "      <td>0.757000</td>\n",
       "      <td>1.606000</td>\n",
       "      <td>2.287000</td>\n",
       "      <td>3.357000</td>\n",
       "      <td>21.98000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>area error</th>\n",
       "      <td>569.0</td>\n",
       "      <td>40.337079</td>\n",
       "      <td>45.491006</td>\n",
       "      <td>6.802000</td>\n",
       "      <td>17.850000</td>\n",
       "      <td>24.530000</td>\n",
       "      <td>45.190000</td>\n",
       "      <td>542.20000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>smoothness error</th>\n",
       "      <td>569.0</td>\n",
       "      <td>0.007041</td>\n",
       "      <td>0.003003</td>\n",
       "      <td>0.001713</td>\n",
       "      <td>0.005169</td>\n",
       "      <td>0.006380</td>\n",
       "      <td>0.008146</td>\n",
       "      <td>0.03113</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>compactness error</th>\n",
       "      <td>569.0</td>\n",
       "      <td>0.025478</td>\n",
       "      <td>0.017908</td>\n",
       "      <td>0.002252</td>\n",
       "      <td>0.013080</td>\n",
       "      <td>0.020450</td>\n",
       "      <td>0.032450</td>\n",
       "      <td>0.13540</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>concavity error</th>\n",
       "      <td>569.0</td>\n",
       "      <td>0.031894</td>\n",
       "      <td>0.030186</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.015090</td>\n",
       "      <td>0.025890</td>\n",
       "      <td>0.042050</td>\n",
       "      <td>0.39600</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>concave points error</th>\n",
       "      <td>569.0</td>\n",
       "      <td>0.011796</td>\n",
       "      <td>0.006170</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.007638</td>\n",
       "      <td>0.010930</td>\n",
       "      <td>0.014710</td>\n",
       "      <td>0.05279</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>symmetry error</th>\n",
       "      <td>569.0</td>\n",
       "      <td>0.020542</td>\n",
       "      <td>0.008266</td>\n",
       "      <td>0.007882</td>\n",
       "      <td>0.015160</td>\n",
       "      <td>0.018730</td>\n",
       "      <td>0.023480</td>\n",
       "      <td>0.07895</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>fractal dimension error</th>\n",
       "      <td>569.0</td>\n",
       "      <td>0.003795</td>\n",
       "      <td>0.002646</td>\n",
       "      <td>0.000895</td>\n",
       "      <td>0.002248</td>\n",
       "      <td>0.003187</td>\n",
       "      <td>0.004558</td>\n",
       "      <td>0.02984</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>worst radius</th>\n",
       "      <td>569.0</td>\n",
       "      <td>16.269190</td>\n",
       "      <td>4.833242</td>\n",
       "      <td>7.930000</td>\n",
       "      <td>13.010000</td>\n",
       "      <td>14.970000</td>\n",
       "      <td>18.790000</td>\n",
       "      <td>36.04000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>worst texture</th>\n",
       "      <td>569.0</td>\n",
       "      <td>25.677223</td>\n",
       "      <td>6.146258</td>\n",
       "      <td>12.020000</td>\n",
       "      <td>21.080000</td>\n",
       "      <td>25.410000</td>\n",
       "      <td>29.720000</td>\n",
       "      <td>49.54000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>worst perimeter</th>\n",
       "      <td>569.0</td>\n",
       "      <td>107.261213</td>\n",
       "      <td>33.602542</td>\n",
       "      <td>50.410000</td>\n",
       "      <td>84.110000</td>\n",
       "      <td>97.660000</td>\n",
       "      <td>125.400000</td>\n",
       "      <td>251.20000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>worst area</th>\n",
       "      <td>569.0</td>\n",
       "      <td>880.583128</td>\n",
       "      <td>569.356993</td>\n",
       "      <td>185.200000</td>\n",
       "      <td>515.300000</td>\n",
       "      <td>686.500000</td>\n",
       "      <td>1084.000000</td>\n",
       "      <td>4254.00000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>worst smoothness</th>\n",
       "      <td>569.0</td>\n",
       "      <td>0.132369</td>\n",
       "      <td>0.022832</td>\n",
       "      <td>0.071170</td>\n",
       "      <td>0.116600</td>\n",
       "      <td>0.131300</td>\n",
       "      <td>0.146000</td>\n",
       "      <td>0.22260</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>worst compactness</th>\n",
       "      <td>569.0</td>\n",
       "      <td>0.254265</td>\n",
       "      <td>0.157336</td>\n",
       "      <td>0.027290</td>\n",
       "      <td>0.147200</td>\n",
       "      <td>0.211900</td>\n",
       "      <td>0.339100</td>\n",
       "      <td>1.05800</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>worst concavity</th>\n",
       "      <td>569.0</td>\n",
       "      <td>0.272188</td>\n",
       "      <td>0.208624</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.114500</td>\n",
       "      <td>0.226700</td>\n",
       "      <td>0.382900</td>\n",
       "      <td>1.25200</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>worst concave points</th>\n",
       "      <td>569.0</td>\n",
       "      <td>0.114606</td>\n",
       "      <td>0.065732</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.064930</td>\n",
       "      <td>0.099930</td>\n",
       "      <td>0.161400</td>\n",
       "      <td>0.29100</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>worst symmetry</th>\n",
       "      <td>569.0</td>\n",
       "      <td>0.290076</td>\n",
       "      <td>0.061867</td>\n",
       "      <td>0.156500</td>\n",
       "      <td>0.250400</td>\n",
       "      <td>0.282200</td>\n",
       "      <td>0.317900</td>\n",
       "      <td>0.66380</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>worst fractal dimension</th>\n",
       "      <td>569.0</td>\n",
       "      <td>0.083946</td>\n",
       "      <td>0.018061</td>\n",
       "      <td>0.055040</td>\n",
       "      <td>0.071460</td>\n",
       "      <td>0.080040</td>\n",
       "      <td>0.092080</td>\n",
       "      <td>0.20750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Target</th>\n",
       "      <td>569.0</td>\n",
       "      <td>0.627417</td>\n",
       "      <td>0.483918</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.00000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                         count        mean         std         min  \\\n",
       "mean radius              569.0   14.127292    3.524049    6.981000   \n",
       "mean texture             569.0   19.289649    4.301036    9.710000   \n",
       "mean perimeter           569.0   91.969033   24.298981   43.790000   \n",
       "mean area                569.0  654.889104  351.914129  143.500000   \n",
       "mean smoothness          569.0    0.096360    0.014064    0.052630   \n",
       "mean compactness         569.0    0.104341    0.052813    0.019380   \n",
       "mean concavity           569.0    0.088799    0.079720    0.000000   \n",
       "mean concave points      569.0    0.048919    0.038803    0.000000   \n",
       "mean symmetry            569.0    0.181162    0.027414    0.106000   \n",
       "mean fractal dimension   569.0    0.062798    0.007060    0.049960   \n",
       "radius error             569.0    0.405172    0.277313    0.111500   \n",
       "texture error            569.0    1.216853    0.551648    0.360200   \n",
       "perimeter error          569.0    2.866059    2.021855    0.757000   \n",
       "area error               569.0   40.337079   45.491006    6.802000   \n",
       "smoothness error         569.0    0.007041    0.003003    0.001713   \n",
       "compactness error        569.0    0.025478    0.017908    0.002252   \n",
       "concavity error          569.0    0.031894    0.030186    0.000000   \n",
       "concave points error     569.0    0.011796    0.006170    0.000000   \n",
       "symmetry error           569.0    0.020542    0.008266    0.007882   \n",
       "fractal dimension error  569.0    0.003795    0.002646    0.000895   \n",
       "worst radius             569.0   16.269190    4.833242    7.930000   \n",
       "worst texture            569.0   25.677223    6.146258   12.020000   \n",
       "worst perimeter          569.0  107.261213   33.602542   50.410000   \n",
       "worst area               569.0  880.583128  569.356993  185.200000   \n",
       "worst smoothness         569.0    0.132369    0.022832    0.071170   \n",
       "worst compactness        569.0    0.254265    0.157336    0.027290   \n",
       "worst concavity          569.0    0.272188    0.208624    0.000000   \n",
       "worst concave points     569.0    0.114606    0.065732    0.000000   \n",
       "worst symmetry           569.0    0.290076    0.061867    0.156500   \n",
       "worst fractal dimension  569.0    0.083946    0.018061    0.055040   \n",
       "Target                   569.0    0.627417    0.483918    0.000000   \n",
       "\n",
       "                                25%         50%          75%         max  \n",
       "mean radius               11.700000   13.370000    15.780000    28.11000  \n",
       "mean texture              16.170000   18.840000    21.800000    39.28000  \n",
       "mean perimeter            75.170000   86.240000   104.100000   188.50000  \n",
       "mean area                420.300000  551.100000   782.700000  2501.00000  \n",
       "mean smoothness            0.086370    0.095870     0.105300     0.16340  \n",
       "mean compactness           0.064920    0.092630     0.130400     0.34540  \n",
       "mean concavity             0.029560    0.061540     0.130700     0.42680  \n",
       "mean concave points        0.020310    0.033500     0.074000     0.20120  \n",
       "mean symmetry              0.161900    0.179200     0.195700     0.30400  \n",
       "mean fractal dimension     0.057700    0.061540     0.066120     0.09744  \n",
       "radius error               0.232400    0.324200     0.478900     2.87300  \n",
       "texture error              0.833900    1.108000     1.474000     4.88500  \n",
       "perimeter error            1.606000    2.287000     3.357000    21.98000  \n",
       "area error                17.850000   24.530000    45.190000   542.20000  \n",
       "smoothness error           0.005169    0.006380     0.008146     0.03113  \n",
       "compactness error          0.013080    0.020450     0.032450     0.13540  \n",
       "concavity error            0.015090    0.025890     0.042050     0.39600  \n",
       "concave points error       0.007638    0.010930     0.014710     0.05279  \n",
       "symmetry error             0.015160    0.018730     0.023480     0.07895  \n",
       "fractal dimension error    0.002248    0.003187     0.004558     0.02984  \n",
       "worst radius              13.010000   14.970000    18.790000    36.04000  \n",
       "worst texture             21.080000   25.410000    29.720000    49.54000  \n",
       "worst perimeter           84.110000   97.660000   125.400000   251.20000  \n",
       "worst area               515.300000  686.500000  1084.000000  4254.00000  \n",
       "worst smoothness           0.116600    0.131300     0.146000     0.22260  \n",
       "worst compactness          0.147200    0.211900     0.339100     1.05800  \n",
       "worst concavity            0.114500    0.226700     0.382900     1.25200  \n",
       "worst concave points       0.064930    0.099930     0.161400     0.29100  \n",
       "worst symmetry             0.250400    0.282200     0.317900     0.66380  \n",
       "worst fractal dimension    0.071460    0.080040     0.092080     0.20750  \n",
       "Target                     0.000000    1.000000     1.000000     1.00000  "
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.describe().T"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "89e44421",
   "metadata": {},
   "source": [
    "#### This tells us that the values are pretty heterogenous magnitudes. Scaling might be needed."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "8fc8aaeb",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 569 entries, 0 to 568\n",
      "Data columns (total 31 columns):\n",
      " #   Column                   Non-Null Count  Dtype  \n",
      "---  ------                   --------------  -----  \n",
      " 0   mean radius              569 non-null    float64\n",
      " 1   mean texture             569 non-null    float64\n",
      " 2   mean perimeter           569 non-null    float64\n",
      " 3   mean area                569 non-null    float64\n",
      " 4   mean smoothness          569 non-null    float64\n",
      " 5   mean compactness         569 non-null    float64\n",
      " 6   mean concavity           569 non-null    float64\n",
      " 7   mean concave points      569 non-null    float64\n",
      " 8   mean symmetry            569 non-null    float64\n",
      " 9   mean fractal dimension   569 non-null    float64\n",
      " 10  radius error             569 non-null    float64\n",
      " 11  texture error            569 non-null    float64\n",
      " 12  perimeter error          569 non-null    float64\n",
      " 13  area error               569 non-null    float64\n",
      " 14  smoothness error         569 non-null    float64\n",
      " 15  compactness error        569 non-null    float64\n",
      " 16  concavity error          569 non-null    float64\n",
      " 17  concave points error     569 non-null    float64\n",
      " 18  symmetry error           569 non-null    float64\n",
      " 19  fractal dimension error  569 non-null    float64\n",
      " 20  worst radius             569 non-null    float64\n",
      " 21  worst texture            569 non-null    float64\n",
      " 22  worst perimeter          569 non-null    float64\n",
      " 23  worst area               569 non-null    float64\n",
      " 24  worst smoothness         569 non-null    float64\n",
      " 25  worst compactness        569 non-null    float64\n",
      " 26  worst concavity          569 non-null    float64\n",
      " 27  worst concave points     569 non-null    float64\n",
      " 28  worst symmetry           569 non-null    float64\n",
      " 29  worst fractal dimension  569 non-null    float64\n",
      " 30  Target                   569 non-null    int32  \n",
      "dtypes: float64(30), int32(1)\n",
      "memory usage: 135.7 KB\n"
     ]
    }
   ],
   "source": [
    "df.info()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f01df118",
   "metadata": {},
   "source": [
    "#### Feature Scaling first."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "id": "d6d013a4",
   "metadata": {},
   "outputs": [],
   "source": [
    "X = df.drop('Target', axis=1) \n",
    "y = df['Target']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 101,
   "id": "49b37ddc",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.model_selection import train_test_split\n",
    "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=42)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 102,
   "id": "f90f24a6",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.preprocessing import StandardScaler\n",
    "\n",
    "scaler = StandardScaler()\n",
    "\n",
    "X_train_scaled = scaler.fit_transform(X_train)\n",
    "\n",
    "X_test_scaled = scaler.transform(X_test)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4cefef57",
   "metadata": {},
   "source": [
    "### Define RF classifier to be used by Boruta"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 103,
   "id": "945b9ddf",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.ensemble import RandomForestClassifier\n",
    "\n",
    "model = RandomForestClassifier()  #For Boruta"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "54df4e8e",
   "metadata": {},
   "source": [
    "## Boruta Time!"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "id": "1c96a0bd",
   "metadata": {},
   "outputs": [],
   "source": [
    "from boruta import BorutaPy\n",
    "\n",
    "# define Boruta feature selection method\n",
    "feat_selector = BorutaPy(model, n_estimators='auto', verbose=2, random_state=1, max_iter=100)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 105,
   "id": "107a7340",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Iteration: \t1 / 100\n",
      "Confirmed: \t0\n",
      "Tentative: \t30\n",
      "Rejected: \t0\n",
      "Iteration: \t2 / 100\n",
      "Confirmed: \t0\n",
      "Tentative: \t30\n",
      "Rejected: \t0\n",
      "Iteration: \t3 / 100\n",
      "Confirmed: \t0\n",
      "Tentative: \t30\n",
      "Rejected: \t0\n",
      "Iteration: \t4 / 100\n",
      "Confirmed: \t0\n",
      "Tentative: \t30\n",
      "Rejected: \t0\n",
      "Iteration: \t5 / 100\n",
      "Confirmed: \t0\n",
      "Tentative: \t30\n",
      "Rejected: \t0\n",
      "Iteration: \t6 / 100\n",
      "Confirmed: \t0\n",
      "Tentative: \t30\n",
      "Rejected: \t0\n",
      "Iteration: \t7 / 100\n",
      "Confirmed: \t0\n",
      "Tentative: \t30\n",
      "Rejected: \t0\n",
      "Iteration: \t8 / 100\n",
      "Confirmed: \t19\n",
      "Tentative: \t11\n",
      "Rejected: \t0\n",
      "Iteration: \t9 / 100\n",
      "Confirmed: \t19\n",
      "Tentative: \t11\n",
      "Rejected: \t0\n",
      "Iteration: \t10 / 100\n",
      "Confirmed: \t19\n",
      "Tentative: \t11\n",
      "Rejected: \t0\n",
      "Iteration: \t11 / 100\n",
      "Confirmed: \t19\n",
      "Tentative: \t11\n",
      "Rejected: \t0\n",
      "Iteration: \t12 / 100\n",
      "Confirmed: \t19\n",
      "Tentative: \t11\n",
      "Rejected: \t0\n",
      "Iteration: \t13 / 100\n",
      "Confirmed: \t19\n",
      "Tentative: \t11\n",
      "Rejected: \t0\n",
      "Iteration: \t14 / 100\n",
      "Confirmed: \t19\n",
      "Tentative: \t11\n",
      "Rejected: \t0\n",
      "Iteration: \t15 / 100\n",
      "Confirmed: \t19\n",
      "Tentative: \t11\n",
      "Rejected: \t0\n",
      "Iteration: \t16 / 100\n",
      "Confirmed: \t19\n",
      "Tentative: \t11\n",
      "Rejected: \t0\n",
      "Iteration: \t17 / 100\n",
      "Confirmed: \t19\n",
      "Tentative: \t11\n",
      "Rejected: \t0\n",
      "Iteration: \t18 / 100\n",
      "Confirmed: \t19\n",
      "Tentative: \t11\n",
      "Rejected: \t0\n",
      "Iteration: \t19 / 100\n",
      "Confirmed: \t20\n",
      "Tentative: \t10\n",
      "Rejected: \t0\n",
      "Iteration: \t20 / 100\n",
      "Confirmed: \t20\n",
      "Tentative: \t10\n",
      "Rejected: \t0\n",
      "Iteration: \t21 / 100\n",
      "Confirmed: \t20\n",
      "Tentative: \t10\n",
      "Rejected: \t0\n",
      "Iteration: \t22 / 100\n",
      "Confirmed: \t20\n",
      "Tentative: \t10\n",
      "Rejected: \t0\n",
      "Iteration: \t23 / 100\n",
      "Confirmed: \t20\n",
      "Tentative: \t9\n",
      "Rejected: \t1\n",
      "Iteration: \t24 / 100\n",
      "Confirmed: \t20\n",
      "Tentative: \t9\n",
      "Rejected: \t1\n",
      "Iteration: \t25 / 100\n",
      "Confirmed: \t20\n",
      "Tentative: \t9\n",
      "Rejected: \t1\n",
      "Iteration: \t26 / 100\n",
      "Confirmed: \t20\n",
      "Tentative: \t9\n",
      "Rejected: \t1\n",
      "Iteration: \t27 / 100\n",
      "Confirmed: \t20\n",
      "Tentative: \t9\n",
      "Rejected: \t1\n",
      "Iteration: \t28 / 100\n",
      "Confirmed: \t20\n",
      "Tentative: \t9\n",
      "Rejected: \t1\n",
      "Iteration: \t29 / 100\n",
      "Confirmed: \t20\n",
      "Tentative: \t9\n",
      "Rejected: \t1\n",
      "Iteration: \t30 / 100\n",
      "Confirmed: \t20\n",
      "Tentative: \t9\n",
      "Rejected: \t1\n",
      "Iteration: \t31 / 100\n",
      "Confirmed: \t20\n",
      "Tentative: \t9\n",
      "Rejected: \t1\n",
      "Iteration: \t32 / 100\n",
      "Confirmed: \t20\n",
      "Tentative: \t9\n",
      "Rejected: \t1\n",
      "Iteration: \t33 / 100\n",
      "Confirmed: \t20\n",
      "Tentative: \t9\n",
      "Rejected: \t1\n",
      "Iteration: \t34 / 100\n",
      "Confirmed: \t21\n",
      "Tentative: \t7\n",
      "Rejected: \t2\n",
      "Iteration: \t35 / 100\n",
      "Confirmed: \t21\n",
      "Tentative: \t7\n",
      "Rejected: \t2\n",
      "Iteration: \t36 / 100\n",
      "Confirmed: \t21\n",
      "Tentative: \t7\n",
      "Rejected: \t2\n",
      "Iteration: \t37 / 100\n",
      "Confirmed: \t21\n",
      "Tentative: \t7\n",
      "Rejected: \t2\n",
      "Iteration: \t38 / 100\n",
      "Confirmed: \t21\n",
      "Tentative: \t7\n",
      "Rejected: \t2\n",
      "Iteration: \t39 / 100\n",
      "Confirmed: \t21\n",
      "Tentative: \t7\n",
      "Rejected: \t2\n",
      "Iteration: \t40 / 100\n",
      "Confirmed: \t21\n",
      "Tentative: \t7\n",
      "Rejected: \t2\n",
      "Iteration: \t41 / 100\n",
      "Confirmed: \t21\n",
      "Tentative: \t7\n",
      "Rejected: \t2\n",
      "Iteration: \t42 / 100\n",
      "Confirmed: \t21\n",
      "Tentative: \t7\n",
      "Rejected: \t2\n",
      "Iteration: \t43 / 100\n",
      "Confirmed: \t21\n",
      "Tentative: \t7\n",
      "Rejected: \t2\n",
      "Iteration: \t44 / 100\n",
      "Confirmed: \t21\n",
      "Tentative: \t7\n",
      "Rejected: \t2\n",
      "Iteration: \t45 / 100\n",
      "Confirmed: \t21\n",
      "Tentative: \t7\n",
      "Rejected: \t2\n",
      "Iteration: \t46 / 100\n",
      "Confirmed: \t21\n",
      "Tentative: \t7\n",
      "Rejected: \t2\n",
      "Iteration: \t47 / 100\n",
      "Confirmed: \t21\n",
      "Tentative: \t7\n",
      "Rejected: \t2\n",
      "Iteration: \t48 / 100\n",
      "Confirmed: \t21\n",
      "Tentative: \t7\n",
      "Rejected: \t2\n",
      "Iteration: \t49 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t50 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t51 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t52 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t53 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t54 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t55 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t56 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t57 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t58 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t59 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t60 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t61 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t62 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t63 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t64 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t65 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t66 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t67 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t68 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t69 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t70 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t71 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t72 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t73 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t74 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t75 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t76 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t77 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t78 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t79 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t80 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t81 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t82 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t83 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t84 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t85 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t86 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t87 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t88 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t89 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t6\n",
      "Rejected: \t2\n",
      "Iteration: \t90 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t5\n",
      "Rejected: \t3\n",
      "Iteration: \t91 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t5\n",
      "Rejected: \t3\n",
      "Iteration: \t92 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t5\n",
      "Rejected: \t3\n",
      "Iteration: \t93 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t5\n",
      "Rejected: \t3\n",
      "Iteration: \t94 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t5\n",
      "Rejected: \t3\n",
      "Iteration: \t95 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t5\n",
      "Rejected: \t3\n",
      "Iteration: \t96 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t5\n",
      "Rejected: \t3\n",
      "Iteration: \t97 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t5\n",
      "Rejected: \t3\n",
      "Iteration: \t98 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t5\n",
      "Rejected: \t3\n",
      "Iteration: \t99 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t5\n",
      "Rejected: \t3\n",
      "\n",
      "\n",
      "BorutaPy finished running.\n",
      "\n",
      "Iteration: \t100 / 100\n",
      "Confirmed: \t22\n",
      "Tentative: \t1\n",
      "Rejected: \t3\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "BorutaPy(estimator=RandomForestClassifier(n_estimators=73,\n",
       "                                          random_state=RandomState(MT19937) at 0x1801D1E0B40),\n",
       "         n_estimators='auto',\n",
       "         random_state=RandomState(MT19937) at 0x1801D1E0B40, verbose=2)"
      ]
     },
     "execution_count": 105,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "feat_selector.fit(np.array(X_train), np.array(y_train))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ca594aa4",
   "metadata": {},
   "source": [
    "### Print the decisions made by the feature-selector."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 106,
   "id": "9047544e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "This array has info on weather to keep a feature or not!\n",
      " \n",
      "[ True  True  True  True  True  True  True  True False False  True False\n",
      "  True  True False False  True False False False  True  True  True  True\n",
      "  True  True  True  True  True  True]\n"
     ]
    }
   ],
   "source": [
    "print('This array has info on weather to keep a feature or not!\\n ')\n",
    "print(feat_selector.support_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 107,
   "id": "23028d37",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "22"
      ]
     },
     "execution_count": 107,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.sum(feat_selector.support_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 110,
   "id": "e8e4f03e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1 1 1 1 1 1 1 1 3 3 1 7 1 1 6 3 1 2 6 3 1 1 1 1 1 1 1 1 1 1]\n"
     ]
    }
   ],
   "source": [
    "# print('This array has feature rankings!\\n')\n",
    "print(feat_selector.ranking_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 126,
   "id": "83b5d1a9",
   "metadata": {},
   "outputs": [],
   "source": [
    "X_filtered_train = feat_selector.transform(np.array(X_train))\n",
    "\n",
    "X_filtered_test = feat_selector.transform(np.array(X_test))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5edaf3f7",
   "metadata": {},
   "source": [
    "### Now Let's compare performances."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 127,
   "id": "8bc8bfcb",
   "metadata": {},
   "outputs": [],
   "source": [
    "model1 = RandomForestClassifier()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 128,
   "id": "661fb0bd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "RandomForestClassifier()"
      ]
     },
     "execution_count": 128,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model1.fit(X_train, y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 129,
   "id": "5824e1e1",
   "metadata": {},
   "outputs": [],
   "source": [
    "yp_test = model1.predict(X_test_scaled)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 130,
   "id": "2b9153dd",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.metrics import accuracy_score"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 131,
   "id": "eb7828a6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.6993006993006993"
      ]
     },
     "execution_count": 131,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "accuracy_score(y_test, yp_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 132,
   "id": "44d39a2c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "RandomForestClassifier(n_estimators=73,\n",
       "                       random_state=RandomState(MT19937) at 0x1801D1E0B40)"
      ]
     },
     "execution_count": 132,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model.fit(X_filtered_train, y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 133,
   "id": "845901c6",
   "metadata": {},
   "outputs": [],
   "source": [
    "yp_test_b = model.predict(X_filtered_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 134,
   "id": "18638d09",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.965034965034965"
      ]
     },
     "execution_count": 134,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "accuracy_score(y_test, yp_test_b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 135,
   "id": "d1ed8686",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.metrics import confusion_matrix"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 136,
   "id": "bd3b36d0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[51,  3],\n",
       "       [ 2, 87]], dtype=int64)"
      ]
     },
     "execution_count": 136,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "confusion_matrix(y_test, yp_test_b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 137,
   "id": "8444b78d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[11, 43],\n",
       "       [ 0, 89]], dtype=int64)"
      ]
     },
     "execution_count": 137,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "confusion_matrix(y_test, yp_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 144,
   "id": "4eacc378",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Accuracies</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Actual</th>\n",
       "      <td>69.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Boruta</th>\n",
       "      <td>96.5</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        Accuracies\n",
       "Actual        69.9\n",
       "Boruta        96.5"
      ]
     },
     "execution_count": 144,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Comparisons = pd.DataFrame({'Accuracies': [69.9 , 96.5]} , index=['Actual' , 'Boruta'])\n",
    "\n",
    "Comparisons"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 139,
   "id": "f582ceb1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:>"
      ]
     },
     "execution_count": 139,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAVoAAAD4CAYAAACt8i4nAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAAsTAAALEwEAmpwYAAASyUlEQVR4nO3df5BdZX3H8fc32ZBAUEgkCUu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2kovi4cUmqmc8Mk6SatWvqoJ0MWklFcUQrSTXrxrt3GbSSitKNN/42aCUVxakDSaqZQStJNXPVgSTVzBGtJNXMVQeSVLORbOUGiJPLoJVUFOdoJalmztFKUs2co5WkmjW6cOrAR9lIKkq7HmUDEBFfiogdEXHTmH1zI2JtRGxubudU9WPQSirKSDZabi34CnDqM/atAIYycxEw1Hw/LoNWUlEamS23Kpl5DfDbZ+xeCgw2Xw8Cp1f1Y9BKKspEpg4ioj8i1o9p/S38xILM3AbQ3M6v+oInwyQVZSInwzJzABior5pRjmglFaWdJ8P2YHtE9AI0tzuqvmDQSirKSI603PbSaqCv+boPWFX1BacOJBWlnZfgRsTFwCnAYRGxFTgHOA9YGRHLgS3Asqp+DFpJRWnnJbiZ+bY9HFoykX4MWklF8aYyklSzbrwE16CVVBRvKiNJNfPG35JUM+doJalmztFKUs0c0UpSzXyUjSTVzBGtJNXMVQeSVDNPhklSzZw6kKSaeWWYJNXMEa0k1awb52ijG9O/VBHR33xGkfQ0/y7K56NsJlcrT9jU/se/i8IZtJJUM4NWkmpm0E4u5+G0O/5dFM6TYZJUM0e0klQzg1aSambQTpKIODUibouI2yNiRafrUedFxJciYkdE3NTpWlQvg3YSRMR04IvAacBxwNsi4rjOVqUu8BXg1E4XofoZtJPjFcDtmXlHZj4BXAIs7XBN6rDMvAb4bafrUP0M2smxELhrzPutzX2S9gMG7eSI3exzXZ20nzBoJ8dW4Llj3h8J3N2hWiRNMoN2clwPLIqI50XEAcAZwOoO1yRpkhi0kyAzh4F/BK4ENgErM/PmzlalTouIi4GfAMdExNaIWN7pmlQPL8GVpJo5opWkmhm0klQzg1aSambQSlLNDFpJqplBK0k1M2glqWb/B763Ulwhy/oqAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 2 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.heatmap(confusion_matrix(y_test, yp_test_b), annot=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "124b56ba",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
